﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>驰骋表单设计器\\导入导出\\从流程导入</title>

    <link href="../../../../Scripts/easyUI145/themes/icon.css" rel="stylesheet" type="text/css" />
    <link href="../../../../Scripts/easyUI145/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../../../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <script src="../../../../Scripts/easyUI145/jquery.min.js"></script>
    <script src="../../../../Scripts/easyUI145/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../../../Scripts/config.js" type="text/javascript"></script>
    <script src="../../../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../../../Comm/Gener.js" type="text/javascript"></script>
    <script src="DDLBar.js" type="text/javascript"></script>
    <script src="../../../CCFlowEnum.js"></script>

    <script src="../../../../Scripts/jquery-1.11.0.min.js" type="text/javascript"></script>
    <script src="../../../../Scripts/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
    <link href="../../../../Scripts/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="../../../../Scripts/bootstrap/css/font-awesome.css" rel="stylesheet" type="text/css" />

    <script src="../../../../Scripts/bootstrap/bootstrap-table/src/bootstrap-table.js" type="text/javascript"></script>
    <link href="../../../../Scripts/bootstrap/bootstrap-table/src/bootstrap-table.css" rel="stylesheet" type="text/css" />
    <script src="../../../../Scripts/bootstrap/bootstrap-table/src/locale/bootstrap-table-zh-CN.js" type="text/javascript"></script>

    <script src="../../../../Scripts/bootstrap/bootstrap-treeview/src/js/bootstrap-treeview.js" type="text/javascript"></script>
    <link href="../../../../Scripts/bootstrap/bootstrap-treeview/src/css/bootstrap-treeview.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        //页面启动函数.
        var frmID = GetQueryString("FK_MapData");
        var flowNo = GetQueryString("FK_Flow");
        var nodeID = GetQueryString("FK_Node");

        var btnFrmLib = null;
        var selFrmNode = null;
        var Btn_Flows = null;
        $(function () {
            InitBar("FlowFrmImp");


            //流程类别.
            var flowSorts = new Entities("BP.WF.Template.FlowSorts");
            flowSorts.RetrieveAll();

            //流程. FK_FlowSort
            var flows = new Entities("BP.WF.Flows");
            flows.RetrieveAll();

            var html = "<table style='width:500px;'>";

            html += "<tr>";
            html += "<th>#</th>";
            html += "<th>编号</th>";
            html += "<th>名称</th>";
            html += "<th>存储表</th>";
            html += "<th>操作</th>";
            html += "</tr>";

            var num = 0;

            for (var i = 0; i < flowSorts.length; i++) {

                var sort = flowSorts[i];


                html += "<tr>";
                html += "<td colspan=5><b>" + sort.Name + "</b></td>";
                html += "</tr>";


                for (var idx = 0; idx < flows.length; idx++) {

                    var en = flows[idx];
                    if (en.FK_FlowSort != sort.No)
                        continue;
                    num++;
                    html += "<tr>";
                    html += "<td>" + num + "</td>";
                    html += "<td>" + en.No + "</td>";
                    html += "<td>" + en.Name + "</td>";
                    html += "<td>" + en.PTable + "</td>";
                    html += "<td><a href=\"javascript:Imp('" + en.No + "')\" >导入</a></td>";
                    html += "</tr>";
                }
            }

            html += "</table>";

            //加载完成.
            $("#docs").html(html);
        });

        function Imp(flowNo) {

            var frmID = GetQueryString("FrmID");
            if (window.confirm('您确定要导入吗？') == false)
                return;

            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner_ImpExp");
            handler.AddPara("FK_MapData", frmID);
            handler.AddPara("FK_Flow", flowNo);
            var data = handler.DoMethodReturnString("Imp_CopyFromFlow");
            if (data.indexOf('err@') == 0) {
                alert(data);
                return;
            }

            alert(data + '\t\n如果父页面不能刷新，请关闭当前表单设计器重新打开.');
            window.parent.location.href = window.parent.location.href;
        }

    </script>
</head>

<body>
    <div id="bar"> </div>
    <div id="docs"></div>

</body>
</html>
